/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package session;

import entities.Commande;
import entities.Utilisateur;
import javax.ejb.Stateless;
import javax.ejb.LocalBean;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

/**
 *
 * @author Aurelie
 */
@Stateless
@LocalBean
public class GestionnaireCommande {

    @PersistenceContext(unitName = "ProjetWebPU")
    private EntityManager em;
    
     public Commande creeCommande(Long date, Utilisateur utilisateur, int montantTotal) {
        Commande c = new Commande(date, utilisateur, montantTotal);
        getEm().persist(c);
        return c;
    }

    /**
     * @return the em
     */
    public EntityManager getEm() {
        return em;
    }

    /**
     * @param em the em to set
     */
    public void setEm(EntityManager em) {
        this.em = em;
    }
}
